package com.shop.controller;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.servlet.ModelAndView;

import com.admin.dao.AdminDao;
import com.admin.domain.ItemCommand;

@Controller("shopMainController")
public class MainController {
	
	@Autowired
	private AdminDao adminDao;
	
	@RequestMapping("/shop/shopMain.do")
	public ModelAndView form(@RequestParam(value="i_category", defaultValue="all")String i_category){
	
		Map<String, Object> map = new HashMap<String, Object>();
		map.put("i_category", i_category);
		
		//List<ItemCommand> list = adminDao.selectItemList();
		List<ItemCommand> list = adminDao.selectItemList1(map);
		ModelAndView mav =  new ModelAndView();
		mav.setViewName("shopMain");
		mav.addObject("item", list);
		return mav;
	}
	
}
